<?php
    //require_once($_SERVER['DOCUMENT_ROOT'] . '/auth/auth.php');
    require_once('auth/auth.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Welcome!</title>
    	<link href="css/public.css" rel="stylesheet" type="text/css" />
</head>


<body>
	<?php 
		$header_title = 'Welcome ' . $_SESSION['SESS_USER_FNAME'] . ' ' . $_SESSION['SESS_USER_LNAME'] . '!';
		include('header.php'); 
		include('menubar.php');
	?>

	<form class="summary">
		<?php
	
			//Include database connection details
			require_once('db/config.php');

			//Connect to mysql server
			$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
			if($link) {
			
			$db = mysql_select_db(DB_DATABASE);
			$vmid = "Not found";

			if($db) {

				$qry="SELECT vmid, vmm_host, vmm_port FROM vm WHERE uid=" . $_SESSION['SESS_USER_ID'] . ";";
				$result=mysql_query($qry);
	
				if($result) {		
					if(mysql_num_rows($result) == 1) {
						$result = mysql_fetch_assoc($result);
						$vmid 	= $result['vmid'];
						$vmmhost = $result['vmm_host'];
						$vmmport = $result['vmm_port'];
				}}
			}}
	
				echo "<label>User ID</label><input type=\"text\" class=\"textfield\" value='" . $_SESSION['SESS_USER_ID'] . "' />";
		        echo "<label>Username</label><input type=\"text\" class=\"textfield\" value='" . $_SESSION['SESS_USER_USERNAME'] . "' />";
		        echo "<label>First Name</label><input type=\"text\" class=\"textfield\" value='" . $_SESSION['SESS_USER_FNAME'] . "  " . $_SESSION['SESS_USER_LNAME'] . "' />";
		        echo "<label>IP</label><input type=\"text\" class=\"textfield\" value='" . $_SESSION['SESS_USER_IP'] . "' />";
	?>
	</form>

</body>
</html>
